<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006-2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: HelpSystemEdit.php 289 2008-11-14 05:34:40Z steen.rabol@gmail.com $
 *
 */

Prado::using('Application.Common.Data.PortalHelpRecord');
Prado::using('Application.Common.Data.PortalLanguageRecord');

class HelpSystemEdit extends PortalAdminPage
{
	private	$_helpRecord	= null;
	
	public function onLoad($param)
	{
		parent::onLoad($param);
		$this->setAdminPageTitle("Edit help page");
	}

	public function getHelpRecord()
	{
		if($this->_helpRecord === null)
		{
			$this->_helpRecord = PortalHelpRecord::finder()->findBypagename_AND_culture($this->Request['pagename'],$this->Request['culture']);
		}
		
		return $this->_helpRecord;
	}
	
	public function SaveHelpPage($sender, $param)
	{
		if($this->IsValid)
		{
			$lsRec				= $this->HelpRecord;
			$lsRec->title		= $this->strTitle->Text;
			$lsRec->content		= $this->HelpContent->Text;
			$lsRec->save();
			$this->gotoPage('Admin.HelpSystem');
		}
	}

	public function CancelContent($sender, $param)
	{
		$this->gotoPage('Admin.HelpSystem');
	}
}
?>